﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using QRCodePass.Core.Models.EnumTypes;

namespace QRCodePass.Core.Models
{
    public class Student
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [Display(Name = "姓名")]
        [StringLength(50)]
        public string Name { get; set; }

        [Display(Name = "电子邮箱")]
        public string Email { get; set; }
        /// <summary>
        /// 主修科目
        /// </summary>
        public MajorEnum? Major { get; set; }

        public string PhotoPath { get; set; }
        /// <summary>
        /// 加密的ID
        /// </summary>
        [NotMapped]
        public string EncryptedId { get; set; }

        [Display(Name = "系部名称")]
        [NotMapped]
        public string DepartmentName { get; set; }

        [Display(Name = "宿舍名称")]
        [NotMapped]
        public string BuildName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Display(Name = "密码")]
        public string Pwd { get; set; }

        [Display(Name = "宿舍楼栋ID")]
        public int BuildId { get; set; }

        [Display(Name = "所属系部ID")]
        public int DepartmentId { get; set; }
        /// <summary>
        /// 入学时间
        /// </summary>
        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime EnrollmentDate { get; set; }
        /// <summary>
        /// 学号，用来登录
        /// </summary>
        [Display(Name = "学号")]
        public string StudentNo { get; set; }
        public virtual ICollection<StudentProcess> StudentProcesses { get; set; }
    }
}